package read;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

/**
 * @ClassName CustomStringStringConverter
 * @Description
 * @Author zhengjiang(99514925 @ qq.com)
 * @Date 2020-06-03 14:39
 * @Version V1.0
 **/
public class CustomStringStringConverter implements Converter<String> {
    @Override
    public Class supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    /**
     * 功能描述: 读的时候用
     * @Param :
     * @Return:
     * @Date: 2020-06-03 14:41
    */
    @Override
    public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return "自定义"+cellData.getStringValue();
    }

    /**
     * 功能描述: 写的时候用
     * @Param :
     * @Return:
     * @Date: 2020-06-03 14:42
    */
    @Override
    public CellData convertToExcelData(String s, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return new CellData(s);
    }
}
